﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ISRecord.View
{
    /// <summary>
    /// Interaction logic for SelectSheetDialog.xaml
    /// </summary>
    public partial class SelectSheetDialog : Window
    {
        public SelectSheetDialog(IList<string> listSource)
        {
            InitializeComponent();
            base.DataContext = listSource;
        }
        public string SelectedSheetName
        {
            get;
            private set;
        }
        private void CancelClicked(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();

        }

        private void OkClicked(object sender, RoutedEventArgs e)
        {
            OkSelection();

        }

        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            
            SelectedSheetName = ((ListBox)sender).SelectedItem as string;
        }


        private void ListBoxItemDoubleCliked(object sender, MouseButtonEventArgs e)
        {
            OkSelection();
        }
        private void OkSelection()
        {
            this.DialogResult = true;
            this.Close();
        }
        private void CancelSelection()
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
